<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class connection</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../signals/reference.html#header.boost.signals.connection_hpp" title="Header &lt;boost/signals/connection.hpp&gt;">
<link rel="prev" href="trackable.html" title="Class trackable">
<link rel="next" href="scoped_connection.html" title="Class scoped_connection">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="trackable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../signals/reference.html#header.boost.signals.connection_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="scoped_connection.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.signals.connection"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class connection</span></h2>
<p>boost::signals::connection &#8212; Query/disconnect a signal-slot connection.</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../signals/reference.html#header.boost.signals.connection_hpp" title="Header &lt;boost/signals/connection.hpp&gt;">boost/signals/connection.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="connection.html" title="Class connection">connection</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="connection.html#boost.signals.connectionconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="connection.html#idp76532240-bb"><span class="identifier">connection</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="connection.html#idp76649104-bb"><span class="identifier">connection</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  connection&amp; <a class="link" href="connection.html#idp83675776-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="connection.html#idp81819008-bb">connection management</a></span>
  <span class="keyword">void</span> <a class="link" href="connection.html#idp83556176-bb"><span class="identifier">disconnect</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="connection.html#idp81914928-bb"><span class="identifier">connected</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="connection.html#idp76241680-bb">blocking</a></span>
  <span class="keyword">void</span> <a class="link" href="connection.html#idp76241872-bb"><span class="identifier">block</span></a><span class="special">(</span><span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="connection.html#idp81843920-bb"><span class="identifier">unblock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="connection.html#idp83116656-bb"><span class="identifier">blocked</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="connection.html#idp83436336-bb">modifiers</a></span>
  <span class="keyword">void</span> <a class="link" href="connection.html#idp83436528-bb"><span class="identifier">swap</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="connection.html#idp80776800-bb">comparisons</a></span>
  <span class="keyword">bool</span> <a class="link" href="connection.html#idp76176192-bb"><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="connection.html#idp76812224-bb"><span class="keyword">operator</span><span class="special">&lt;</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span>

<span class="comment">// <a class="link" href="connection.html#idp76689456-bb">specialized algorithms</a></span>
<span class="keyword">void</span> <a class="link" href="connection.html#boost.signals.connection.swap_idp83449680"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">,</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp161148448"></a><h2>Description</h2>
<p>The <a class="link" href="connection.html" title="Class connection">connection</a> class represents
          a connection between a Signal and a Slot. It is a
          lightweight object that has the ability to query whether the
          signal and slot are currently connected, and to disconnect
          the signal and slot. It is always safe to query or
          disconnect a connection.</p>
<div class="refsect2">
<a name="idp161149680"></a><h3>
<a name="boost.signals.connectionconstruct-copy-destruct"></a><code class="computeroutput">connection</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idp76532240-bb"></a><span class="identifier">connection</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>Sets the currently represented connection to the
          NULL connection.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">!this-&gt;<a class="link" href="connection.html#idp81914928-bb">connected</a>()</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp76649104-bb"></a><span class="identifier">connection</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p><code class="computeroutput">this</code> references
          the connection referenced by
          <code class="computeroutput">other</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout">connection&amp; <a name="idp83675776-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p><code class="computeroutput">this</code> references
          the connection referenced by
          <code class="computeroutput">other</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp161164496"></a><h3>
<a name="idp81819008-bb"></a><code class="computeroutput">connection</code> connection management</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp83556176-bb"></a><span class="identifier">disconnect</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>If
             <code class="computeroutput">this-&gt;<a class="link" href="connection.html#idp81914928-bb">connected</a>()</code>,
             disconnects the signal and slot referenced by this;
             otherwise, this operation is a no-op.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">!this-&gt;<a class="link" href="connection.html#idp81914928-bb">connected</a>()</code>.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp81914928-bb"></a><span class="identifier">connected</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if this
            references a non-NULL connection that is still active
            (connected), and <code class="computeroutput">false</code>
            otherwise.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp161174848"></a><h3>
<a name="idp76241680-bb"></a><code class="computeroutput">connection</code> blocking</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp76241872-bb"></a><span class="identifier">block</span><span class="special">(</span><span class="keyword">bool</span> should_block <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><code class="computeroutput">connected()</code></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><code class="computeroutput">blocked() == should_block</code></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Will not throw.</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp81843920-bb"></a><span class="identifier">unblock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><code class="computeroutput">connected()</code></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><code class="computeroutput">!blocked()</code></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Will not throw.</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp83116656-bb"></a><span class="identifier">blocked</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td>
<code class="computeroutput">true</code> if the associated slot is either disconnected or blocked, <code class="computeroutput">false</code> otherwise.</td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Will not throw.</td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp161189296"></a><h3>
<a name="idp83436336-bb"></a><code class="computeroutput">connection</code> modifiers</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp83436528-bb"></a><span class="identifier">swap</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>Swaps the connections referenced in
            <code class="computeroutput">this</code> and
            <code class="computeroutput">other</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idp161195408"></a><h3>
<a name="idp80776800-bb"></a><code class="computeroutput">connection</code> comparisons</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp76176192-bb"></a><span class="keyword">operator</span><span class="special">==</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> other<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if
            <code class="computeroutput">this</code> and
            <code class="computeroutput">other</code> reference the same
            connection or both reference the NULL connection, and
            <code class="computeroutput">false</code>
            otherwise.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp76812224-bb"></a><span class="keyword">operator</span><span class="special">&lt;</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> other<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if the
            connection referenced by
            <code class="computeroutput">this</code> precedes the
            connection referenced by
            <code class="computeroutput">other</code> based on some
            unspecified ordering, and
            <code class="computeroutput">false</code>
            otherwise.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp161209200"></a><h3>
<a name="idp76689456-bb"></a><code class="computeroutput">connection</code> specialized algorithms</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="boost.signals.connection.swap_idp83449680"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> x<span class="special">,</span> <a class="link" href="connection.html" title="Class connection">connection</a><span class="special">&amp;</span> y<span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p><code class="computeroutput">x.swap(y)</code></p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2004 Douglas Gregor<p>Use, modification and distribution is subject to the Boost
    Software License, Version 1.0. (See accompanying file
    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="trackable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../signals/reference.html#header.boost.signals.connection_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="scoped_connection.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
